<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivitiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activities', function (Blueprint $table) {
            $table->uuid('id')->unique();
            $table->uuid('user_id');//属于某个用户
            $table->uuid('model_id');//属于某个模型
            $table->uuid('template_id');//某个模版
            $table->integer('category');//1.h5应用 2.app应用
            $table->string('name',255);//活动名称
            $table->dateTime('startTime');
            $table->dateTime('endTime');
            $table->boolean('isPause');//是否暂停
            $table->integer('clicks');//浏览量
            $table->integer('joins');//参加人数
            $table->integer('winnings'); //中奖人数
            $table->string('limit',255);//json字符串{"num":10,"type":"day(all)"}
            $table->string('backgroundImg',255);
            $table->string('backgroundColor',20);
            $table->text('rule');//活动规则，json字符串
            $table->text('description');
            //landindPage 1为设置活动落地页，2自定义落地页
            $table->text('shares');//json字符串{"isopen":true,"icon":"","title":"","description":"","share_url":"","qrcode":"","landindPage":1,"download":{"ios":"","android":""}}
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('activities');
    }
}
